<?php TPL::output('m/header_meta.tpl.htm'); ?>

<!-- 标题 -->
<div class="aw-title">
	<img src="<?php echo get_avatar_url($this->recipient_user['uid'], 'mid'); ?>" width="25" class="img" />
	<?php _e('与 %s 对话', $this->recipient_user['user_name']); ?>
	<span class="pull-right color-999"><?php echo count($this->list); ?> 条</span>
</div>
<!-- end 标题 -->

<!-- 内容 -->
	<div class="container padding-0">
		<!-- 列表 -->
		<div class="aw-inbox-read-list">
			<ul>
				<?php foreach($this->list AS $key => $val){ ?>
				<li <?php if ($val['uid'] == $this->user_id) { ?> class="active"<?php } ?>>
					<img width="25" class="img" src="<?php if ($val['uid'] != $this->user_id) { ?><?php echo get_avatar_url($val['uid'], 'mid'); ?><?php } else { ?><?php echo get_avatar_url($this->user_id, 'mid'); ?><?php } ?>" alt="" />
					<div class="content">
						<p><?php echo nl2br($val['message']); ?></p>
						<span class="color-999"><?php echo date_friendly($val['add_time']); ?></span>
						<span class="collapse"><?php if ($val['receipt'] AND $val['uid'] == $this->user_id) { ?> (<?php _e('对方于 %s 已读', date_friendly($val['receipt'])); ?>)<?php } ?></span>
						<i></i>
						<i class="active"></i>
					</div>
				</li>
				<?php } ?>
			</ul>
		</div>
		<!-- end 列表 -->
		<!-- 私信回复box -->
		<div class="aw-inbox-replay-box">
			<form action="inbox/ajax/send/" onsubmit="return false;" method="post" id="pm_form">
				<input type="hidden" name="post_hash" value="<?php echo new_post_hash(); ?>" />
	   	  		<input type="hidden" name="recipient" value="<?php echo $this->recipient_user['user_name']; ?>" />
	   	  		<input type="hidden" name="return_url" value="/m/inbox/" />
				<input type="text" class="form-control" name="message" />
				<a class="btn btn-success btn-normal">发送</a>
			</form>
		</div>
		<!-- end 私信回复box -->
	</div>
<!-- end 内容 -->

<script>
    $(function() {
        $(".aw-inbox-replay-box .btn-success").removeAttr("disabled");
        $(".aw-inbox-replay-box .btn-success").click(function () {
			$(this).attr("disabled","disabled");
            AWS.ajax_post($('#pm_form'));
        })
    })
</script>

<?php TPL::output('m/footer.tpl.htm'); ?>